<template>
  <div class="wrapper example10-container">
    <!-- 返回区域 -->
    <div
      class="back-box"
      @click="$router.go(-1)"
    >返回</div>

    <!-- 标题区域 -->
    <h1 class="title-box">10、vue3生命周期函数(配置项写法)</h1>

    <!-- 实例区域 -->
    <div class="example10-box">
      <button @click="isShowDemo2 = !isShowDemo2">隐藏/显示</button>
      <Demo2 v-if="isShowDemo2"></Demo2>
    </div>
  </div>
</template>

<script>
import Demo2 from '@/components/Demo2.vue';
import { ref } from 'vue';

export default {
  name: 'Example10',
  components: {
    Demo2
  },
  setup() {
    // 数据
    const isShowDemo2 = ref(true);

    return {
      isShowDemo2
    };
  }
};
</script>

<style lang="scss" scoped>
.example10-container {
  // 返回区域
  & > .back-box {
    width: 50px;
    height: 23px;
    line-height: 20px;
    text-align: center;
    background-color: #efefef;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #767676;
    border-radius: 4px;
    cursor: pointer;
  }

  // 标题区域
  & > .title-box {
    margin-bottom: 30px;
  }

  // 实例区域
  & > .example10-box {
    & > button {
      margin-bottom: 20px;
      cursor: pointer;
    }
  }
}
</style>
